// 题目来源:https://iai.sh.cn/problem/556
#include <bits/stdc++.h>
using namespace std;

int main() {
  int num;
  cin >> num; // 直接读取一个整数
  int ge = num % 10;
  int shi = num / 10 % 10;
  int bai = num / 100 % 10;
  int qian = num / 1000;

  ge = (ge + 5) % 10;
  shi = (shi + 5) % 10;
  bai = (bai + 5) % 10;
  qian = (qian + 5) % 10;
  cout << ge << shi << bai << qian;
  
  return 0;
}
